﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LogicUniversityBiz;

namespace LogicUniversity.clerks
{
    public partial class ModifySupplier : System.Web.UI.Page
    {
        protected void Page_PreInit(Object sender, EventArgs e)
        {
            //(Session["Role"]
            if (Session["Role"] as string != "Clerk")
            {
                Response.Redirect("~/Login.aspx");
            }

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                TextBox1.Text = Session["SupplierCode"].ToString();
                TextBox2.Text = Session["SupplierName"].ToString();
                TextBox3.Text = Session["ContactName"].ToString();
                TextBox4.Text = Session["PhoneNo"].ToString();
                TextBox5.Text = Session["FaxNo"].ToString();
                TextBox6.Text = Session["Address"].ToString();
                TextBox1.Enabled = false;

                Session.Remove("SupplierCode");
                Session.Remove("SupplierName");
                Session.Remove("ContactName");
                Session.Remove("PhoneNo");
                Session.Remove("FaxNo");
                Session.Remove("Address");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            EditSupplierList updateSup = new EditSupplierList();
            updateSup.updateSupplier(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text, TextBox6.Text);

            Response.Redirect("MaintainSupplierList.aspx");
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            Response.Redirect("MaintainSupplierList.aspx");
        }
    }
}